import {FilterEnum} from "../enums/FilterEnum"
import {Button} from 'antd';
import {memo} from "react";

interface FilterProps {
    setFilter: (filter: FilterEnum) => void
}

const Filter = memo(function Filter({setFilter}: FilterProps) {
    console.log("Filter重新渲染了")
    return (
        <div className="w-full flex  justify-between my-5">
            <Button color="primary" variant="solid" onClick={() => setFilter(FilterEnum.ALL)}>全部</Button>
            <Button color="primary" variant="solid" onClick={() => setFilter(FilterEnum.COMPLETED)}>已完成</Button>
            <Button color="primary" variant="solid" onClick={() => setFilter(FilterEnum.UNCOMPLETED)}>未完成</Button>
        </div>
    )
})

/** 根据待办事项状态筛选 */
export default Filter